<?php
/**
 * 入口
 * 如果找不到图片，则重定向到这个文件，生成图片，返回图片，状态200
 */
//只接受这种格式99469ff033e2760b3a2778338270df18-80-200xauto.jpg
if(in_array(strtolower($_SERVER['REQUEST_METHOD']), array('get', 'delete')) && 0 === preg_match('/\/[0-9a-z]{32}-[0-9]{1,3}-([0-9]+|auto)x([0-9]+|auto)\.(jpg|png)$/', $_SERVER['REQUEST_URI']))
{
    exit;
}
require(dirname(__FILE__) . '/../lib/auto_load.php');
try
{
    $c = new ImgController();
    $r = $c->router();
    $c->output($r);
}
catch(ControllerException $e)
{
    $error = $e -> getMessage();
    $data= array(
        'result' => array(
            'status' => json_decode($error, true)
        )
    );
    BasicController::output($data);
}
exit;
?>
